<form action="/login/process" method="post" class="contentLeft">
	<h3>请登录</h3>
	<p>如果您已拥有拾客帐号，请使用已有的帐号信息直接进行登录即可，不需要重复注册。</p> 
	<?php echo view::show('standard/messages')?>
	<?php echo view::show('standard/errors')?>
	<table class="formTable" >
		<tr><th>用户名</th><td><input type="text" name="username" id="username" value="<?php echo @$view['username']?>" maxlength="12"/> 
			<span id="checkusername" class="check"></span></td></tr> 
		<tr><th>密码</th><td><input type="password" name="password" id="password"/> 
			<span id="checkpassword" class="check"></span></td></tr> 
		<tr><th>验证码</th><td><img src="/assets/seccode.php" id="verifyimg" title="刷新" onclick="changecode()"/> 
			<p class="tip">请输入图中的数字和字母</p> 
			<input type="text" name="seccode" id="seccode"/> 
			<span id="checkseccode" class="check"></span></td></tr> 
		<tr><th></th><td><button type="submit" id="loginbtn" class="submit">登录</button></td></tr> 
	</table>
	<h3>没有帐号?</h3>
	<p><a href="/register">注册</a>成为拾客用户，获得更快速的交互体验！</p> 
</form>
<script type="text/javascript">
$(function(){
	$('#username').focus();

	verifycode = /^[0-9]{4}$/i;
	verified = 0;
	
	$('#username').blur(function(){
		$("#checkusername").text(($(this).val()=="")?"请输入用户名":"");
	});
	$('#password').blur(function(){
		$("#checkpassword").text(($(this).val()=="")?"请输入密码":"");
	});
	$('#seccode').blur(function(){
		if(!verifycode.test($(this).val())){
			$('#checkseccode').text("验证码为4位数字");
		}else{
			$.getJSON("/check/seccode/"+$(this).val(),function(data){
				$("#checkseccode").text(data.msg);
				verified = data.code;
			});
		}
	});
	$('#loginbtn').click(function(){
		if($('#username').val()==""){$('#username').blur().focus(); return false;}
		if($('#password').val()==""){$('#password').blur().focus(); return false;}
		if(!verifycode.test($('#seccode').val())){$('#seccode').blur().focus(); return false;}
		if(!verified){$('#seccode').focus(); return false;}
	});
});
</script>